import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import VueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import path from 'path'
import legacy from '@vitejs/plugin-legacy';

export default defineConfig({
	
	base: './',
	plugins: [
		vue(),
		legacy({
			targets: ['ie>=11'],
			additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
		}),
		VueSetupExtend(),
		AutoImport({
			resolvers: [ElementPlusResolver()]
		}),
		Components({
			resolvers: [ElementPlusResolver()]
		}),
	],
	optimizeDeps: {
		include: ['schart.js']
	},
	resolve:{
    alias:{
      "@":path.resolve(__dirname,'./src')
    }
  },
	server: {
    host: 'localhost',
    cors: true,
    proxy: {
      '/api': {
        target: "http://xxxxx",
        changeOrigin: true
      }
    }
  }
});
